<template>
  <div style="height: 100%">
    <el-container style="height: 100%">
      <el-header style="background: #1b478c">
        <div class="head">
          <span style="color: white;font-size: 24px;">管 理 系 统</span>
          <span id="username" class="name" text="${session.user?.name}"></span>
          <el-button type="text" class="logout" @click="logout" style="color: white;font-size: 18px;line-height: 35px;">登 出</el-button >
        </div>
      </el-header>
      <el-container>
        <el-aside width="200px" class="aside">
          <el-menu style="height: 100%;background-color: #e3ecf9"
                   default-active="2"
                   unique-opened router>


            <template slot="title">
              <i class="el-icon-location"></i>
              <span>用户管理</span>
            </template>

              <el-menu-item :index="'/' + item.url" v-for="item in menuAll" :key="item.id">
                <span>{{item.name}}</span>
              </el-menu-item>



          </el-menu>
        </el-aside>
        <el-main style="padding: 0px;background-color: whitesmoke">
          <router-view></router-view>
        </el-main>
      </el-container>
    </el-container>
  </div>
</template>
<style>
.logout{
  float: right;
  line-height: 35px;
}
.head{
  height:80px;
  line-height:60px;
}
</style>
<script>
import {apiLogout} from "@/assets/api/LoginAPI";
export default {
  data() {
    return {
      userInfo: {},
      menuAll:[
        {
          id: '7',
          name: '用户管理',
          url: 'Home/User',
        },
        {
          id: '73',
          name: '公文管理',
          url: 'Home/File',
        },
        {
          id: '75412',
          name: '传输管理',
          url: 'Home/FileSend',
        },
        {
          id: '17',
          name: '组织管理',
          url: 'Home/Org',
        },
        {
          id: '7123',
          name: '单位管理',
          url: 'Home/Category',
        },
        {
          id: '712',
          name: '日志管理',
          url: 'Home/Log',
        },
      ],
    }
  },
  methods:{
    logout(){
      apiLogout()
      window.sessionStorage.clear()
      this.$store.commit("logout");
      this.$router.push("/login")
    }
  }
}
</script>